<template>
  <a-modal :maskClosable="false"
    :title="title"
    :width="800"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭">

    <a-spin :spinning="confirmLoading">
      <div>


        <a-table
          ref='table'
          size='middle'
          bordered
          rowKey='id'
          :columns='columns'
          :dataSource='dataSource'
          :pagination='ipagination'
          :loading='loading'
          @change='handleTableChange'>

        <span slot='action' slot-scope='text, record'>
           <a-popconfirm title='确定删除吗?' @confirm='() => handleDelete(record.id)' v-if='record.status==0'>
                          <a>取消参与</a>
                        </a-popconfirm>
        </span>

        </a-table>
      </div>
    </a-spin>
  </a-modal>
</template>

<script>
import { httpAction, putAction, getAction, postAction } from '@api/manage'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
export default {
  name: 'hHisActivityModal',
  mixins: [JeecgListMixin],
  components: {
  },
  data() {
    return {
      title: '操作',
      visible: false,
      model: {
        organizer:""
      },
      layout: {
        labelCol: { span: 8 },
        wrapperCol: { span: 14 }
      },
      queryParam: {
        activityCode:"",
      },
      disableMixinCreated:true,
      confirmLoading: false,
      // 表头
      columns: [
        {
          title: '姓名',
          align: 'center',
          dataIndex: 'personName'
        },
        {
          title: '性别',
          align: 'center',
          dataIndex: 'sex',
          customRender: (t, row, index) => {
            return t=='1'?"男":"女";
          }
        },
        {
          title: '床位',
          align: 'center',
          dataIndex: 'patientBed'
        },
        {
          title: '年龄',
          align: 'center',
          dataIndex: 'age'
        },
        {
          title: '状态',
          align: 'center',
          dataIndex: 'status',
          customRender: (t, row, index) => {
            //0 待签到 1已签到 3请假
            return t=='0'?"待签到":t=='1'?"已签到":"请假";
          }
        },
        {
          title: '参与者身份',
          align: 'center',
          dataIndex: 'personType',
          customRender: (t, row, index) => {
            //人员类型 0医生 1护士 2护理师 3护理员 4社工 5参与长者
            if(t=='0'){
              return "医生"
            }else if(t=='1'){
              return "护士"
            }else if(t=='2'){
              return "护理师"
            }else if(t=='3'){
              return "护理员"
            }else if(t=='4'){
              return "社工"
            }
            return "参与长者"
          }
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: '/his/activity/list/detail',
        edit: '/his/activity'
      }
    }
  },
  created() {
    this.modelDefault = JSON.parse(JSON.stringify(this.model))
  },
  methods: {
    edit(record) {
      this.visible = true
      this.queryParam.activityCode=record.activityCode;
      this.loadData()
    },
    close() {
      this.$emit('close')
      this.visible = false
    },
    handleOk() {
      this.close()
    },
    handleCancel() {
      this.close()
    },


  }
}
</script>

<style scoped>

</style>